package p08.p0807;

import java.util.Scanner;

/**
 * Created by wy on 7/18/2017.
 */
public  class  GuessNumber {

    //获取随机数 1-100；
    public static int getRandomNumber(){
        int intsuiji = (int) ((Math.random()) * 100) + 1;
        System.out.println("获取的随机数为："+intsuiji);
        return intsuiji;
    }

    //判断数字大小
    public static void panDuan(int intsuiji){
        Scanner scanner = new Scanner(System.in);
        int index = 0;
        while (index != intsuiji) {
            System.out.println("In put:");
            index = scanner.nextInt();
            if (index > intsuiji) {
                System.out.println("猜大了！");
            } else if (index < intsuiji) {
                System.out.println("猜小了！");
            } else if (index == intsuiji) {
                System.out.println("恭喜你猜对了！");
                break;
            }
        }
    }



}


/*
*


        Scanner scanner = new Scanner(System.in);
        int index = 0;
        while (index != intsuiji) {
         System.out.println("In put:");
            index = scanner.nextInt();
            if (index > intsuiji) {
                System.out.println("猜大了！");
            } else if (index < intsuiji) {
                System.out.println("猜小了！");
            } else if (index == intsuiji) {
                System.out.println("恭喜你猜对了！");
                break;
            }
        }*/